#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
    int N;
    scanf("%d", &N);
    int arr[2];
    int flag;
    for (int i = 0; i < N; i++)
    {
        scanf("%d", &arr[i]);
    }
    for (int i = 0; i < N; i++)
    {
        flag = 0;
        for (int j = 2; j < arr[i]; j++)
        {
            if (arr[i] % j == 0)
            {
                flag = 1;
                break;
            }
        }
        if (flag == 0)
            printf("Yes\n");
        else
            printf("No\n");
    }
    return 0;
}